﻿using System;

namespace FortuneCookie.EPiServer.SearchAndReplace
{

    /// <summary>
    /// Error entity class
    /// </summary>
    public sealed class Error : EntityBase
    {

        #region Members

        private Guid _searchAndReplaceId;
        private int _pageId;
        private int _workId;
        private string _propertyName;
        private string _errorMessage;
        private bool _pageProperty;
        private int _sortIndex;

        #endregion Members

        #region Constructor

        /// <summary>
        /// Default constructor
        /// </summary>
        public Error()
        {
            _searchAndReplaceId = Guid.Empty;
            _propertyName = string.Empty;
            _errorMessage = string.Empty;
        }

        #endregion Constructor

        #region Properties

        /// <summary>
        /// Gets or sets the Search and replace Id
        /// </summary>
        public Guid SearchAndReplaceId
        {
            get
            {
                return _searchAndReplaceId;
            }
            set
            {
                if (_searchAndReplaceId == value)
                    return;

                _searchAndReplaceId = value;
                HasChanges = true;
            }
        }

        /// <summary>
        /// Gets or sets the page id
        /// </summary>
        public int PageId
        {
            get
            {
                return _pageId;
            }
            set
            {
                if (_pageId == value)
                    return;

                _pageId = value;
                HasChanges = true;
            }
        }

        /// <summary>
        /// Gets or sets the work id
        /// </summary>
        public int WorkId
        {
            get
            {
                return _workId;
            }
            set
            {
                if (_workId == value)
                    return;

                _workId = value;
                HasChanges = true;
            }
        }

        /// <summary>
        /// Gets or sets the property name
        /// </summary>
        public string PropertyName
        {
            get
            {
                return _propertyName;
            }
            set
            {
                if (_propertyName == value)
                    return;

                _propertyName = value;
                HasChanges = true;
            }
        }

        /// <summary>
        /// Gets or sets the error message
        /// </summary>
        public string ErrorMessage
        {
            get
            {
                return _errorMessage;
            }
            set
            {
                if (_errorMessage == value)
                    return;

                _errorMessage = value;
                HasChanges = true;
            }
        }

        /// <summary>
        /// Gets or sets whether the property is a page property
        /// </summary>
        public bool PageProperty
        {
            get
            {
                return _pageProperty;
            }
            set
            {
                if (_pageProperty == value)
                    return;

                _pageProperty = value;
                HasChanges = true;
            }
        }

        /// <summary>
        /// Gets or sets the sort index
        /// </summary>
        public int SortIndex
        {
            get
            {
                return _sortIndex;
            }
            set
            {
                if (_sortIndex == value)
                    return;

                _sortIndex = value;
                HasChanges = true;
            }
        }

        #endregion Properties

    }
}
